﻿using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Windows.Media;
using System.Windows.Media.Imaging;

using Game.Common;

namespace Game.Toolkit.Internal
{
    public static class BuildingResourceFile
    {
        public static BitmapImage Depot
        {
            get { return GetImage("bld_asc_depot"); }
        }

        public static BitmapImage Depot2
        {
            get { return GetImage("bld_asc_depot2"); }
        }

        public static BitmapImage HeadQuarters
        {
            get { return GetImage("bld_asc_hq_big"); }
        }

        public static BitmapImage Mine3
        {
            get { return GetImage("bld_asc_mine3"); }
        }

        public static BitmapImage Airport
        {
            get { return GetImage("bld_asc_airport"); }
        }
        
//        public static ImageSource NuclearPlant
//        {
//            get { return GetImage("bld_asc_nuclear_plant"); }
//        }

        public static BitmapImage Factory
        {
            get { return GetImage("bld_asc_factory"); }
        }

        public static BitmapImage Solar
        {
            get { return GetImage("bld_asc_solar2"); }
        }

        public static BitmapImage Windpower
        {
            get { return GetImage("bld_asc_windpower_dry"); }
        }

        public static BitmapImage GetImage(string name)
        {
            BitmapImage image = new BitmapImage();
            string uri = 
                @"Game.Toolkit.Resources.Buildings."
                + name + ".png";
            Assembly a = Assembly.GetExecutingAssembly();
            Stream stream = a.GetManifestResourceStream(uri);
            image.BeginInit();
            image.StreamSource = stream;
            image.EndInit();
            
            return image;
       }
    }
}
